package com.bwie.assist.controller;

import java.util.Arrays;
import java.util.Map;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.bwie.assist.entity.OperationLogEntity;
import com.bwie.assist.service.OperationLogService;
import com.bwie.common.utils.PageUtils;
import com.bwie.common.utils.R;



/**
 * 
 *
 * @author lfw
 * @email sunlightcs@gmail.com
 * @date 2022-03-25 18:53:29
 */
@RestController
@RequestMapping("assist/operationlog")
public class OperationLogController {
    @Autowired
    private OperationLogService operationLogService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = operationLogService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{operationId}")
    public R info(@PathVariable("operationId") Integer operationId){
		OperationLogEntity operationLog = operationLogService.getById(operationId);

        return R.ok().put("operationLog", operationLog);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody OperationLogEntity operationLog){
		operationLogService.save(operationLog);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody OperationLogEntity operationLog){
		operationLogService.updateById(operationLog);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] operationIds){
		operationLogService.removeByIds(Arrays.asList(operationIds));

        return R.ok();
    }

}
